#!/bin/bash

echo "🚀 开始部署AI导航页到Gitee Pages..."

# 1. 构建项目
echo "📦 正在构建项目..."
npm run build

if [ $? -ne 0 ]; then
    echo "❌ 构建失败，请检查错误信息"
    exit 1
fi

echo "✅ 构建成功！"

# 2. 添加所有更改
echo "📝 添加文件到Git..."
git add .

# 3. 提交更改
echo "💾 提交更改..."
read -p "请输入提交信息 (默认: 更新AI导航页): " commit_message
commit_message=${commit_message:-"更新AI导航页"}
git commit -m "$commit_message"

# 4. 推送到Gitee
echo "🚀 推送到Gitee..."
git push origin master

if [ $? -eq 0 ]; then
    echo "🎉 部署成功！"
    echo "📱 请到Gitee Pages服务中手动更新部署"
    echo "🌐 访问地址: https://你的用户名.gitee.io/ai-navigation/"
else
    echo "❌ 推送失败，请检查网络连接和权限"
fi 